package com.fcscs.cservice.client.common.model.reservation;

import java.util.Collection;
import java.util.Map;

import com.fcscs.core.gwt.common.NonDomainModelData;
import com.fcscs.cservice.client.common.CServiceConstants;
import com.fcscs.cservice.domain.model.ReservationView;
import com.fcscs.share.gwt.common.ShareGWTConstants;

public class ReservationViewModelData extends NonDomainModelData<ReservationView> {

	public ReservationViewModelData(ReservationView t) {
		super(t);
	}

	@Override
	protected void populateNames(Collection<String> tempNames) {
		tempNames.add(CServiceConstants.CONFIRMATION_NO);
		tempNames.add(ShareGWTConstants.ROOM);
		tempNames.add(ShareGWTConstants.ROOM_STATUS);
		tempNames.add(ShareGWTConstants.GUEST_NAME);
		tempNames.add(CServiceConstants.RESERVATION_STATUS);
		tempNames.add(CServiceConstants.MEM_LV);
		tempNames.add(CServiceConstants.MEM_NO);
		tempNames.add(ShareGWTConstants.ARRIVAL_DATE);
		tempNames.add(ShareGWTConstants.ETA);
		tempNames.add(ShareGWTConstants.DEPARTUAL_DATE);
		tempNames.add(ShareGWTConstants.ETD);
		tempNames.add(CServiceConstants.BAGGAGE);
		tempNames.add(ShareGWTConstants.MSG);
	}

	@Override
	protected void populateProps(Map<String, Object> props) {
		props.put(CServiceConstants.CONFIRMATION_NO, entity.getConfirmationNo());
		props.put(ShareGWTConstants.ROOM, entity.getRoomNumber());
		props.put(ShareGWTConstants.ROOM_STATUS, entity.getRoomStatus());
		props.put(ShareGWTConstants.GUEST_NAME, entity.getGuestFirstName() + " " + entity.getGuestLastName());
		props.put(CServiceConstants.RESERVATION_STATUS, entity.getReservationStatus());
		if (entity.getMemberships() != null && entity.getMemberships().size() > 0) {
			props.put(CServiceConstants.MEM_LV, entity.getMemberships().get(0).getLevel());
			props.put(CServiceConstants.MEM_NO, entity.getMemberships().get(0).getNumber());
		}
		props.put(ShareGWTConstants.ARRIVAL_DATE, CServiceConstants.DATE_FORMAT1.format(entity.getArrivalDateTime()));
		props.put(ShareGWTConstants.ETA, CServiceConstants.DATE_FORMAT2.format(entity.getArrivalDateTime()));
		props.put(ShareGWTConstants.DEPARTUAL_DATE, CServiceConstants.DATE_FORMAT1.format(entity.getDepartureDateTime()));
		props.put(ShareGWTConstants.ETD, CServiceConstants.DATE_FORMAT2.format(entity.getDepartureDateTime()));
	}

	
	@Override
	protected <X> void setProperty(String property, X value) {
		// TODO Auto-generated method stub
		
	}


}
